package com.xpf.controller;

import com.xpf.service.status.IResultCallbackService;
import com.xpf.service.status.entity.BpmInstanceVO;
import com.xpf.service.status.entity.BpmProcessSuccessEvent;
import com.xpf.service.status.enums.BpmInstanceStatus;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/statusController")
@RequiredArgsConstructor
public class StatusController {

    private final IResultCallbackService resultCallbackService;

    @PostMapping("/statusBPM")
    public String statusBPM(){

        BpmInstanceVO bpmInstanceVO = new BpmInstanceVO();
        bpmInstanceVO.setInstanceStatus(BpmInstanceStatus.COMPLETED);

        BpmProcessSuccessEvent event = new BpmProcessSuccessEvent(bpmInstanceVO);
        // 流程状态（BpmInstanceStatus）从instanceStatus中取,一般是COMPLETED，TERMINATED，CANCELED
        resultCallbackService.resultCallbackSuccess(event);
        return null;
        //模拟第一次提交

        //来来来
        //测试2
        //master1
        //test1测试1

        //test1测试2
    }

        //test1测试2
        //lalal
    }
    //这次没冲突
}
